/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package podologia.beansDB;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Hernan
 */
@Entity
@Table(name = "fdigital")
@NamedQueries({@NamedQuery(name = "Fdigital.findAll", query = "SELECT f FROM Fdigital f"), @NamedQuery(name = "Fdigital.findByIdFDigital", query = "SELECT f FROM Fdigital f WHERE f.idFDigital = :idFDigital"), @NamedQuery(name = "Fdigital.findByNombre", query = "SELECT f FROM Fdigital f WHERE f.nombre = :nombre"), @NamedQuery(name = "Fdigital.findByDescripcion", query = "SELECT f FROM Fdigital f WHERE f.descripcion = :descripcion")})
public class Fdigital implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idFDigital")
    private Integer idFDigital;
    @Column(name = "nombre")
    private String nombre;
    @Column(name = "descripcion")
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idFDigital")
    private Collection<Fdigitalxatencion> fdigitalxatencionCollection;

    public Fdigital() {
    }

    public Fdigital(Integer idFDigital) {
        this.idFDigital = idFDigital;
    }

    public Integer getIdFDigital() {
        return idFDigital;
    }

    public void setIdFDigital(Integer idFDigital) {
        Integer oldIdFDigital = this.idFDigital;
        this.idFDigital = idFDigital;
        changeSupport.firePropertyChange("idFDigital", oldIdFDigital, idFDigital);
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        String oldNombre = this.nombre;
        this.nombre = nombre;
        changeSupport.firePropertyChange("nombre", oldNombre, nombre);
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        String oldDescripcion = this.descripcion;
        this.descripcion = descripcion;
        changeSupport.firePropertyChange("descripcion", oldDescripcion, descripcion);
    }

    public Collection<Fdigitalxatencion> getFdigitalxatencionCollection() {
        return fdigitalxatencionCollection;
    }

    public void setFdigitalxatencionCollection(Collection<Fdigitalxatencion> fdigitalxatencionCollection) {
        this.fdigitalxatencionCollection = fdigitalxatencionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idFDigital != null ? idFDigital.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Fdigital)) {
            return false;
        }
        Fdigital other = (Fdigital) object;
        if ((this.idFDigital == null && other.idFDigital != null) || (this.idFDigital != null && !this.idFDigital.equals(other.idFDigital))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return nombre;
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
